package com.fesine.learn.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fesine.learn.dao.IDaoService;
import com.fesine.learn.po.UserInfoPo;
import com.fesine.learn.service.UserInfoService;

/**
 * 用户信息service实现
 */
@Service("userInfoService")
public class UserInfoServiceImpl implements UserInfoService {

	@Resource
	private IDaoService daoService;
	
	@Override
	public int addUserInfo(UserInfoPo userInfoPo){
		return daoService.insert(userInfoPo);
	}
	
	@Override
	public int modifyUserInfo(UserInfoPo userInfoPo) { 
		
		return daoService.update(userInfoPo);
	}

	@Override
	public int deleteUserInfo(UserInfoPo userInfoPo) { 
		
		return daoService.delete(userInfoPo);
	}

	@Override
	public void deleteUsers(String[] ids) { 
		UserInfoPo userInfoPo;
		for (String id : ids) {
			userInfoPo = new UserInfoPo(); 
			userInfoPo.setId(id); 
			this.deleteUserInfo(userInfoPo);
			}
	}

	@Override
	public UserInfoPo getUserInfo(UserInfoPo userInfoPo) { 
		
		return daoService.selectOne(userInfoPo);
	}


	@Override
	public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo) { 
		
		return daoService.selectList(userInfoPo);
	}


	@Override
	public List<UserInfoPo> listUserInfo(UserInfoPo userInfoPo, int pageNo, int pageSie) {

	return daoService.selectList(userInfoPo, pageNo,pageSie);
	}


	@Override
	public int getTotal(UserInfoPo userInfoPo) { 
		
		return daoService.count(userInfoPo);
	}
}
